﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using System.Data;
using GtsServer.Common;

namespace GtsServer.Manage.Controller
{
    public class EventChanceController
    {
        EventChanceDAL eventChanceDal = new EventChanceDAL();
        public List<EventChance> GetList(string strWhere = "")
        {
            DataSet ds = new DataSet();
            ds = eventChanceDal.GetList(strWhere);
            return IListDataSet.DataSetToIList<EventChance>(ds, 0).ToList();
        }

        public List<EventChance> GetList(int chanceTypeID, int eventID)
        {
            DataSet ds = new DataSet();
            ds = eventChanceDal.GetList(chanceTypeID, eventID);
            return IListDataSet.DataSetToIList<EventChance>(ds, 0).ToList();
        }

        public bool Add(EventChance model)
        {
            return eventChanceDal.Add(model) > 0 ? true : false;
        }

        public bool Update(EventChance model)
        {
            return eventChanceDal.Update(model);
        }

        public bool UpdateChanceValue(int id, int chanceValue)
        {
            return eventChanceDal.UpdateChanceValue(id, chanceValue);
        }

        public bool DeleteByEventID(int eventID)
        {
            return eventChanceDal.DeleteByEventID(eventID);
        }

        public bool DeleteByEventMouldID(int eventMouldID)
        {
            return eventChanceDal.DeleteByEventMouldID(eventMouldID);
        }

        public bool DeleteByChanceTypeID(int typeID)
        {
            return eventChanceDal.DeleteByChanceTypeID(typeID);
        }
    }
}
